-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed a bug caused by paths with spaces in Windows. #51
base: master
Are you sure you want to change the base?
Conversation
" but executable() get confused by the quotes, so we remove them | ||
if has("win32") && !executable(split(g:clang_format#command, '"')[0]) | ||
return 1 | ||
elseif !has("win32") && !executable(g:clang_format#command) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Conditions of
if
are complicated. I think it's good to separate them to multipleif
statements - Indentation looks collapsed
if has('win32') || has('win64')
if !executable(split(...))
return 1
endif
elseif !executable(g:clang_format#command)
return 1
endif
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fixed these in the latest commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
I think quoting command name is not good. Does escaping white spaces such as |
Unfortunatelly, escaping whitespace with \ does not work. |
I noticed that this is a problem when the command is run. I'll commit a fix for it tomorrow. Could you try it before merging this PR? |
Sure, I'll test it.
|
Please try latest with below config (removing quotes) let g:clang_format#command = 'C:/Program Files (x86)/LLVM/bin/clang-format.exe' |
I get this error with the latest commit. |
Thank you for the report. It looks to resolve the quoting problem on Windows 😄 And it seems to fail to check clang version. I'll fix version check more strict. Could you show the output of |
Could you try the latest? (and please let me know the output of |
Sorry for the delay
This is the result of
|
Thank you for confirmation. Hmm... I think clang-format command failed by some reason. I'll investigate it on my Windows machine (I actually don't have Windows machine for development...) Please ensure that your code can be formatted correctly from command line. |
If I specify
g:clang_format='"C:/Program Files (x86)/LLVM/bin/clang-format.exe"' (For example)
then the call to executable() fails because the executable function gets confused by the quotes, which
are necessary to escape the spaces.
This patch removes those quotes before testing if it is executable.